package com.example.demo.service.iml;

import com.example.demo.dao.UserMapper;
import com.example.demo.entity.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UserServiceIml implements UserService {
    @Autowired
    UserMapper userMapper;
    @Override
    public int registerUser(User user) {
        if (userMapper.findUserByName(user)!=0){
            throw new RuntimeException("账号已存在");

        }
        return userMapper.create(user);
    }

}
